Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added payload to the request build. This fixes #30. #32

Closed
wants to merge 1 commit into from
Closed

Added payload to the request build. This fixes #30. #32

wants to merge 1 commit into from

Conversation

naroga
Copy link

@naroga naroga commented Aug 10, 2015

As of right now, if one passes a payload on a request to react/http, such as the following:

curl -X POST http://<myurl>/ --data "{\"key\": \"value\"}" -H "Content-Type: application/json"

The payload is unreachable within the server. It won't be parsed as a querystring on RequestHeaderParser::parseRequest and will thus be discarded.

This can't happen, and I believe this PR fixes the issue.

It adds a new parameter to the Request constructor ($payload), at the end, with a default value (null), as a way to not break backwards compatibility with classes that may omit this parameter. It also adds a getPayload() method to the request.

@naroga
Copy link
Author

naroga commented Aug 10, 2015

Notice this leaves the queryString untouched in a way to allow even for GET requests with both a querystring and a payload. This allows even for some weirder requests, like the second elasticsearch example here.

@naroga naroga changed the title Added payload the the request build. Added payload to the request build. Aug 10, 2015
@naroga naroga changed the title Added payload to the request build. Added payload to the request build. This fixes #30. Aug 10, 2015
@naroga
Copy link
Author

naroga commented Aug 10, 2015

This fixes #30.

@cboden
Copy link
Member

cboden commented Aug 10, 2015

This will only work for non-streamed requests. See this comment for buffering and reading the entire body for non-streamed requests.

naroga referenced this pull request Aug 10, 2015
@naroga
Copy link
Author

naroga commented Aug 10, 2015

Obsolete because of b36fb25

@naroga naroga closed this Aug 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants